package o;

import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.Metadata.Entry;
import com.google.android.exoplayer2.metadata.scte35.PrivateCommand;
import com.google.android.exoplayer2.metadata.scte35.SpliceInsertCommand;
import com.google.android.exoplayer2.metadata.scte35.SpliceNullCommand;
import com.google.android.exoplayer2.metadata.scte35.SpliceScheduleCommand;
import com.google.android.exoplayer2.metadata.scte35.TimeSignalCommand;
import java.nio.ByteBuffer;

public final class ahl implements ahd {
    private final ane ˊ = new ane();
    private anq ˎ;
    private final anc ॱ = new anc();

    public Metadata ˊ(ahg o_ahg) {
        if (this.ˎ == null || o_ahg.ˊ != this.ˎ.ˎ()) {
            this.ˎ = new anq(o_ahg.ˏ);
            this.ˎ.ˊ(o_ahg.ˏ - o_ahg.ˊ);
        }
        ByteBuffer byteBuffer = o_ahg.ॱ;
        byte[] array = byteBuffer.array();
        int limit = byteBuffer.limit();
        this.ॱ.ॱ(array, limit);
        this.ˊ.ˋ(array, limit);
        this.ˊ.ˎ(39);
        long ॱ = ((long) this.ˊ.ॱ(32)) | (((long) this.ˊ.ॱ(1)) << 32);
        this.ˊ.ˎ(20);
        int ॱ2 = this.ˊ.ॱ(12);
        int ॱ3 = this.ˊ.ॱ(8);
        this.ॱ.ˎ(14);
        Object spliceNullCommand;
        switch (ॱ3) {
            case 0:
                spliceNullCommand = new SpliceNullCommand();
                break;
            case 4:
                spliceNullCommand = SpliceScheduleCommand.ॱ(this.ॱ);
                break;
            case 5:
                spliceNullCommand = SpliceInsertCommand.ॱ(this.ॱ, ॱ, this.ˎ);
                break;
            case 6:
                spliceNullCommand = TimeSignalCommand.ˊ(this.ॱ, ॱ, this.ˎ);
                break;
            case 255:
                spliceNullCommand = PrivateCommand.ˎ(this.ॱ, ॱ2, ॱ);
                break;
            default:
                Entry entry = null;
                break;
        }
        if (entry == null) {
            return new Metadata(new Entry[0]);
        }
        return new Metadata(entry);
    }
}
